<script>
import Vue from 'vue'
import appUpdate from 'common/util/appUpdate.js'

export default {
  onLaunch: function() {
    uni.getSystemInfo({
      success: function(e) {
        // #ifdef APP-PLUS
        // 检测升级
        appUpdate()
        // #endif
        
        // #ifndef MP
        Vue.prototype.StatusBar = e.statusBarHeight;
        if (e.platform == 'android') {
          Vue.prototype.CustomBar = e.statusBarHeight + 50;
        } else {
          Vue.prototype.CustomBar = e.statusBarHeight + 45;
        };
        // #endif

        // #ifdef MP-WEIXIN
        Vue.prototype.StatusBar = e.statusBarHeight;
        let custom = wx.getMenuButtonBoundingClientRect();
        Vue.prototype.Custom = custom;
        Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
        // #endif		

        // #ifdef MP-ALIPAY
        Vue.prototype.StatusBar = e.statusBarHeight;
        Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
        // #endif
      }
    })
    
    // 万科门窗ERP主题配置
    Vue.prototype.NavBarColor = 'bg-gradual-blue'
    Vue.prototype.Radio_Check_Size = 'scale(0.7)'
    
    // ERP系统横幅配置
    Vue.prototype.bannerList = [
      {id: 1, type: 'image', url: '/static/images/banner/erp-banner-1.jpg', link: ''},
      {id: 2, type: 'image', url: '/static/images/banner/erp-banner-2.jpg', link: ''},
      {id: 3, type: 'image', url: '/static/images/banner/erp-banner-3.jpg', link: ''}
    ]
    
    // 门窗ERP主题色彩配置
    Vue.prototype.ColorList = [
      { title: '企业蓝', name: 'primary', color: '#1890ff' },
      { title: '成功绿', name: 'success', color: '#52c41a' },
      { title: '警告橙', name: 'warning', color: '#fa8c16' },
      { title: '错误红', name: 'error', color: '#ff4d4f' },
      { title: '信息蓝', name: 'info', color: '#13c2c2' },
      { title: '紫罗兰', name: 'purple', color: '#722ed1' },
      { title: '玫瑰红', name: 'magenta', color: '#eb2f96' },
      { title: '火山红', name: 'volcano', color: '#fa541c' },
      { title: '日暮黄', name: 'gold', color: '#faad14' },
      { title: '青柠绿', name: 'lime', color: '#a0d911' },
      { title: '极光绿', name: 'green', color: '#52c41a' },
      { title: '拂晓蓝', name: 'daybreak', color: '#1890ff' },
      { title: '极客蓝', name: 'geek', color: '#2f54eb' },
      { title: '酱紫色', name: 'purple', color: '#722ed1' },
      { title: '中性灰', name: 'gray', color: '#8c8c8c' }
    ]

    // ERP系统全局配置
    Vue.prototype.ERPConfig = {
      appName: '万科门窗ERP',
      version: '1.0.0',
      company: '万科门窗有限公司',
      apiBaseUrl: 'http://localhost:8080',
      uploadUrl: 'http://localhost:8080/sys/common/upload',
      previewUrl: 'http://localhost:8080/sys/common/static'
    }
  },
  
  onShow: function() {
    console.log('万科门窗ERP App Show')
  },
  
  onHide: function() {
    console.log('万科门窗ERP App Hide')
  },
  
  onError: function(err) {
    console.error('万科门窗ERP App Error:', err)
  }
}
</script>

<style>
	@import "plugin/colorui/main.css";
	@import "plugin/colorui/icon.css";
    @import "plugin/colorui/animation.css";
	
	/* 万科门窗ERP全局样式 */
	page {
		background-color: #f5f5f5;
		font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
	}
	
	/* 主题色彩变量 */
	:root {
		--primary-color: #1890ff;
		--success-color: #52c41a;
		--warning-color: #fa8c16;
		--error-color: #ff4d4f;
		--info-color: #13c2c2;
		--text-color: #262626;
		--text-secondary: #8c8c8c;
		--border-color: #d9d9d9;
		--background-color: #f5f5f5;
	}
	
	/* 通用样式 */
	.erp-card {
		background: white;
		border-radius: 12rpx;
		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
		margin-bottom: 24rpx;
	}
	
	.erp-button {
		border-radius: 8rpx;
		font-weight: 500;
		transition: all 0.3s ease;
	}
	
	.erp-input {
		border: 2rpx solid #d9d9d9;
		border-radius: 8rpx;
		padding: 24rpx;
		font-size: 28rpx;
		transition: border-color 0.3s ease;
	}
	
	.erp-input:focus {
		border-color: var(--primary-color);
	}
	
	/* 状态标签样式 */
	.status-tag {
		padding: 8rpx 16rpx;
		border-radius: 16rpx;
		font-size: 24rpx;
		font-weight: 500;
	}
	
	.status-success {
		background-color: #f6ffed;
		color: #52c41a;
		border: 1rpx solid #b7eb8f;
	}
	
	.status-warning {
		background-color: #fff7e6;
		color: #fa8c16;
		border: 1rpx solid #ffd591;
	}
	
	.status-error {
		background-color: #fff2f0;
		color: #ff4d4f;
		border: 1rpx solid #ffccc7;
	}
	
	.status-info {
		background-color: #e6f7ff;
		color: #1890ff;
		border: 1rpx solid #91d5ff;
	}
	
	/* 响应式设计 */
	@media screen and (max-width: 750rpx) {
		.grid.col-4 > view {
			width: 50% !important;
		}
		
		.grid.col-3 > view {
			width: 50% !important;
		}
	}
	
	/* 动画效果 */
	.fade-in {
		animation: fadeIn 0.3s ease-in;
	}
	
	@keyframes fadeIn {
		from { opacity: 0; transform: translateY(20rpx); }
		to { opacity: 1; transform: translateY(0); }
	}
	
	.slide-up {
		animation: slideUp 0.3s ease-out;
	}
	
	@keyframes slideUp {
		from { transform: translateY(100%); }
		to { transform: translateY(0); }
	}
	
	/* 安全区域适配 */
	.safe-area-inset-bottom {
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}
	
	.safe-area-inset-top {
		padding-top: constant(safe-area-inset-top);
		padding-top: env(safe-area-inset-top);
	}
	
	/* 原有样式保持 */
	.nav-list {
		display: flex;
		flex-wrap: wrap;
		padding: 0px 40upx 0px;
		justify-content: space-between;
	}

	.nav-li {
		padding: 30upx;
		border-radius: 12upx;
		width: 45%;
		margin: 0 2.5% 40upx;
		background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
		background-size: cover;
		background-position: center;
		position: relative;
		z-index: 1;
	}

	.nav-li::after {
		content: "";
		position: absolute;
		z-index: -1;
		background-color: inherit;
		width: 100%;
		height: 100%;
		left: 0;
		bottom: -10%;
		border-radius: 10upx;
		opacity: 0.2;
		transform: scale(0.9, 0.9);
	}

	.nav-li.cur {
		color: #fff;
		background: rgb(94, 185, 94);
		box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
	}

	.nav-title {
		font-size: 32upx;
		font-weight: 300;
	}

	.nav-title::first-letter {
		font-size: 40upx;
		margin-right: 4upx;
	}

	.nav-name {
		font-size: 28upx;
		text-transform: Capitalize;
		margin-top: 20upx;
		position: relative;
	}

	.nav-name::before {
		content: "";
		position: absolute;
		display: block;
		width: 40upx;
		height: 6upx;
		background: #fff;
		bottom: 0;
		right: 0;
		opacity: 0.5;
	}

	.nav-name::after {
		content: "";
		position: absolute;
		display: block;
		width: 100upx;
		height: 1px;
		background: #fff;
		bottom: 0;
		right: 40upx;
		opacity: 0.3;
	}

	.nav-name::first-letter {
		font-weight: bold;
		font-size: 36upx;
		margin-right: 1px;
	}

	.nav-li text {
		position: absolute;
		right: 30upx;
		top: 30upx;
		font-size: 52upx;
		width: 60upx;
		height: 60upx;
		text-align: center;
		line-height: 60upx;
	}

	.text-light {
		font-weight: 300;
	}

	@keyframes show {
		0% {
			transform: translateY(-50px);
		}

		60% {
			transform: translateY(40upx);
		}

		100% {
			transform: translateY(0px);
		}
	}

	@-webkit-keyframes show {
		0% {
			transform: translateY(-50px);
		}

		60% {
			transform: translateY(40upx);
		}

		100% {
			transform: translateY(0px);
		}
	}
</style>
